﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Data.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;

namespace iDMS.Models
{
    [MetadataType(typeof(Drawing_Buddy))]
    public partial class Drawing
    {
        public void ClearManufacturer()
        {
            _Manufacturer = default(EntityRef<Manufacturer>);
        }

        public string isPartString
        {
            get
            {
                if (_isPart)
                {
                    return "Part";
                }
                else
                {
                    return "Drawing";
                }
            }
        }
    }

    public class Drawing_Buddy
    {
        [Display(Name = "Manufacturer")]
        public int ManufacturerID { get; set; }

        [Display(Name = "Manufacturer")]
        public string ManufacturerPartNo { get; set; }

        [Display(Name = "Design Change")]
        public int DesignChangeID { get; set; }

        [Display(Name = "Innaplicable Design Change")]
        public System.Nullable<int> InnaplicableDesignChangeID { get; set; }

        [Display(Name = "Unit")]
        public int UnitID { get; set; }

        [Display(Name = "Creator")]
        public int CreatorEmployeeID { get; set; }

        [DataType(DataType.DateTime)]
        [Display(Name = "Last Modified")]
        public System.Nullable<System.DateTime> LastModified { get; set; }


        [Display(Name = "is Part")]
        [Required(ErrorMessage = "is Part is required")]
        public bool isPart { get; set; }

        [Required(ErrorMessage = "Name is required")]
        public String Name { get; set; }

        [Required(ErrorMessage = "Identifier is required")]
        [StringLength(15, MinimumLength = 5, ErrorMessage = "Identifier - The value must be between 5 and 15 characters. ")]
        public string Identifier { get; set; }

    }
}